﻿using System;
using System.Collections.Generic;
using System.Text;

namespace MediaPortal.GUI.iPlayer
{
    static class StringUtils
    {

        /// <summary>
        /// Converts a string with wrong characters and replaces those with the good ones
        /// </summary>
        /// <param name="convertstring">input string</param>
        /// <returns>converted string</returns>
        public static string ConvertString(string convertstring)
        {
            convertstring = convertstring.Replace("&amp;", "&");
            convertstring = convertstring.Replace("&#39;", "'");
            convertstring = convertstring.Replace("&#233;", "é");
            convertstring = convertstring.Replace("&#246;", "ö");
            convertstring = convertstring.Replace("&#235;", "ë");
            convertstring = convertstring.Replace("&#252;", "ü");
            convertstring.Trim();
            return convertstring;
        }

        public static string MakeFirstUpper(string name)
        {
            if (name.Length <= 1) return name.ToUpper();
            Char[] letters = name.ToCharArray();
            letters[0] = Char.ToUpper(letters[0]);
            return new string(letters);
        }
    }
}
